﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    x:Class="EpicLeadManager.Views.Main.PlayersListControl"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Resources/Icons/Icons.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <GroupBox Margin="0" Header="Liste des joueurs">
            <Grid>
                <ListBox Name="Players_ListBox" ItemsSource="{Binding}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <TextBlock Text="{Binding Path=Name}" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                    <ListBox.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.HeaderTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <TextBlock Text="{Binding Path=Name}" FontWeight="Bold" Foreground="Gray"
                                                   FontSize="16" VerticalAlignment="Bottom" />
                                    </StackPanel>
                                </DataTemplate>
                            </GroupStyle.HeaderTemplate>
                        </GroupStyle>
                    </ListBox.GroupStyle>
                </ListBox>
            </Grid>
        </GroupBox>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="2" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition />
                <ColumnDefinition Width="2" />
                <ColumnDefinition Width="40" />
            </Grid.ColumnDefinitions>
            <Button x:Name="AddPlayer_btn" ToolTip="Ajouter un joueur" Click="AddPlayer_btn_OnClick">
                <Rectangle Width="20"
                           Height="20"
                           Fill="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}">
                    <Rectangle.OpacityMask>
                        <VisualBrush Stretch="Fill"
                                     Visual="{StaticResource appbar_add}" />
                    </Rectangle.OpacityMask>
                </Rectangle>
            </Button>
            <Separator Grid.Column="1" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0" />
            <Button x:Name="EditPlayer_btn" ToolTip="Editer un joueur" Grid.Column="2" Click="EditPlayer_btn_OnClick">
                <Rectangle Width="20"
                           Height="20"
                           Fill="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}">
                    <Rectangle.OpacityMask>
                        <VisualBrush Stretch="Fill"
                                     Visual="{StaticResource appbar_edit}" />
                    </Rectangle.OpacityMask>
                </Rectangle>
            </Button>

            <Button x:Name="DeletePlayer_btn" ToolTip="Supprimer un joueur" Grid.Column="5"
                    Click="DeletePlayer_btn_OnClick">
                <Rectangle Width="20"
                           Height="20"
                           Fill="{Binding Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}">
                    <Rectangle.OpacityMask>
                        <VisualBrush Stretch="Fill"
                                     Visual="{StaticResource appbar_delete}" />
                    </Rectangle.OpacityMask>
                </Rectangle>
            </Button>
        </Grid>

    </Grid>
</UserControl>